package gui;

import java.awt.AWTException;
import java.awt.Color;
import java.awt.Robot;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;

import physics.Physics;

public class PlayersMap extends LayeredPane{

	private static final long serialVersionUID = 1L;
	private Physics physics;
	private Robot robot;
	
	public PlayersMap(){
		physics = new Physics(this);
		try {
			robot = new Robot();
		} catch (AWTException e1) {
			e1.printStackTrace();
		}
		
		//getLayers().getComponentsInLayer(3)
		getRockLayer().addMouseMotionListener(new MouseMotionAdapter() {
			public void mouseMoved(MouseEvent e) {
				int energyX = e.getXOnScreen() - MainWindow.getCenterX();
				int energyY = e.getYOnScreen() - MainWindow.getCenterY();
				if( (energyX != 0) || (energyY != 0) ){
					physics.energyPassing(1000 * energyX, 1000 * energyY);
					robot.mouseMove(MainWindow.getCenterX(), MainWindow.getCenterY());
					super.mouseMoved(e);
				}
			}
		});
		
		//robot.mouseMove(centerX,centerY);
		physics.startTime();
	}
	
	public int getBallMass(){
		return 40;
	}
	
	public double getManoeuvrability(){
		return 1;
	}
	
	public double getFrictionalCoefficient(){
		return 0;
	}
	
	public void moveBall(double _x, double _y){
		bd.moveBall(_x, _y);
		//gd.repaint(r);
	}
	

}